<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>My App</title>
    <link rel="stylesheet" href="../../packages/core/css/framework7.min.css">
    <link rel="stylesheet" href="../../css/framework7-icons.css">
  </head>
  <body>
    <div id="app"></div>
    <template id="app-template">
      <f7-app>
        <f7-view main>
          <f7-page>
            <f7-navbar title="Action Sheet"></f7-navbar>
            <f7-block strong>
              <p class="row">
                <!-- One group, open by direct accessing instance .open() method -->
                <f7-button class="col" raised @click="$refs.actionsOneGroup.open()">One group</f7-button>
                <!-- Two groups, open by "actions-open" attribute -->
                <f7-button class="col" raised actions-open="#actions-two-groups">Two groups</f7-button>
              </p>
              <p>
                <!-- Actions Grid, open by changing actionGridOpened prop -->
                <f7-button raised @click="actionGridOpened = true">Action Grid</f7-button>
              </p>
            </f7-block>
      
            <f7-block-title>Action Sheet To Popover</f7-block-title>
            <f7-block strong>
              <p>Action Sheet can be automatically converted to Popover (for tablets). This button will open Popover on tablets and Action Sheet on phones: <f7-button style="display:inline-block" class="button-to-popover" @click="openActionsPopover">Actions</f7-button></p>
            </f7-block>
      
            <!-- One Group -->
            <f7-actions ref="actionsOneGroup">
              <f7-actions-group>
                <f7-actions-label>Do something</f7-actions-label>
                <f7-actions-button bold>Button 1</f7-actions-button>
                <f7-actions-button>Button 2</f7-actions-button>
                <f7-actions-button color="red">Cancel</f7-actions-button>
              </f7-actions-group>
            </f7-actions>
      
            <!-- Two Groups -->
            <f7-actions id="actions-two-groups">
              <f7-actions-group>
                <f7-actions-label>Do something</f7-actions-label>
                <f7-actions-button bold>Button 1</f7-actions-button>
                <f7-actions-button>Button 2</f7-actions-button>
              </f7-actions-group>
              <f7-actions-group>
                <f7-actions-button color="red">Cancel</f7-actions-button>
              </f7-actions-group>
            </f7-actions>
      
            <!-- Grid -->
            <f7-actions :grid="true" :opened="actionGridOpened" @actions:closed="actionGridOpened = false">
              <f7-actions-group>
                <f7-actions-button>
                  <img slot="media" src="http://lorempixel.com/96/96/people/1" width="48"/>
                  <span>Button 1</span>
                </f7-actions-button>
                <f7-actions-button>
                  <img slot="media" src="http://lorempixel.com/96/96/people/2" width="48"/>
                  <span>Button 2</span>
                </f7-actions-button>
                <f7-actions-button>
                  <img slot="media" src="http://lorempixel.com/96/96/people/3" width="48"/>
                  <span>Button 3</span>
                </f7-actions-button>
              </f7-actions-group>
              <f7-actions-group>
                <f7-actions-button>
                  <img slot="media" src="http://lorempixel.com/96/96/fashion/4" width="48"/>
                  <span>Button 4</span>
                </f7-actions-button>
                <f7-actions-button>
                  <img slot="media" src="http://lorempixel.com/96/96/fashion/5" width="48"/>
                  <span>Button 5</span>
                </f7-actions-button>
                <f7-actions-button>
                  <img slot="media" src="http://lorempixel.com/96/96/fashion/6" width="48"/>
                  <span>Button 6</span>
                </f7-actions-button>
              </f7-actions-group>
            </f7-actions>
          </f7-page>
        </f7-view>
      </f7-app>
      
    </template>
    <script>
      var component = {
        data() {
          return {
            actionGridOpened: false,
          };
        },
        methods: {
          openActionsPopover() {
            const self = this;
            const app = self.$f7;
            if (!self.actionsToPopover) {
              self.actionsToPopover = app.actions.create({
                buttons: [
                  {
                    text: 'Do something',
                    label: true,
                  },
                  {
                    text: 'Button 1',
                    bold: true,
                  },
                  {
                    text: 'Button 2',
                  },
                  {
                    text: 'Cancel',
                    color: 'red',
                  },
                ],
                // Need to specify popover target
                targetEl: self.$el.querySelector('.button-to-popover'),
              });
            }
      
            // Open
            self.actionsToPopover.open();
          },
        },
      }
    </script>
    <script src="../../packages/vue/vue.min.js"></script>
    <script src="../../packages/vue/framework7-vue.min.js"></script>
    <script src="../../packages/core/js/framework7.min.js"></script>
    <script>
      var theme = 'ios';
      if (location.href.indexOf('theme=md') >= 0) theme = 'md';
      
      if (Framework7.use) Framework7.use(Framework7Vue, { theme: theme });
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(Framework7Vue, { theme: theme });
      
      var plugin = {
        params: {
          theme: theme,
        }
      };
      
      if (Framework7.use) Framework7.use(plugin);
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(plugin);
      
      if (typeof component === 'undefined') {
        var component = {};
      }
      if (typeof routes === 'undefined') {
        var routes = [];
      }
      component.el = '#app';
      component.template = '#app-template';
      
      new Vue(component);
    </script>
  </body>
</html>